<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html class="win-frame">
<head>
<title>${name_china}管理-编辑${name_china}</title>
<%@include file="/common/head.jsp" %>

<!-- 上传下载插件 -->
 <link href="<%=request.getContextPath()%>/static/plugin/uploadify/style/uploadify.css" rel="stylesheet">
 <script src="<%=request.getContextPath()%>/static/plugin/uploadify/js/jquery.uploadify.js"></script>

<!-- 时间日期插件 -->
<link href="<%=request.getContextPath()%>/static/plugin/My97DatePicker/skin/default/datepicker.css" rel="stylesheet" >
<script src="<%=request.getContextPath()%>/static/plugin/My97DatePicker/WdatePicker.js"></script>

<!--富文本插件 -->
<script src="<%=request.getContextPath()%>/static/plugin/ckeditor/ckeditor.js"></script>

<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/static/plugin/bootstrap-3.3.7-dist/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/static/plugin/bootstrap-3.3.7-dist/css/bootstrap-theme.min.css">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/static/plugin/font-awesome-4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/static/image-server/style/style.css">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/static/plugin/webuploader-0.1.5/webuploader.css">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/static/plugin/webuploader-0.1.5/uploader.css">
<script type="text/javascript" src="<%=request.getContextPath()%>/static/plugin/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/static/plugin/webuploader-0.1.5/webuploader.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/static/plugin/webuploader-0.1.5/common.js"></script>
<style>
.newtitle{
	float: left;
    width: 46px;
    height: 25px;
    background: #8bc34a;
    text-align: center;
    line-height: 25px;
    color: #fff;
    margin-left: 9px;
    border-radius: 3px;
    cursor:pointer;
}
</style>
</head>
<body class="iframe-page">
<div class="page-title-wrapper">
    <div class="page-title">
        <div class="page-title-text">
            <span>${name_china}管理</span>
            <span class="split"></span>
            <span>编辑${name_china}</span>
        </div>
        <a id="goBack" class="btn-return distance-left" href="javascript:;"><i class="icon icon-arrow-left"></i>返回上级</a>
    </div>
    <div class="page-title-border"></div>
</div>

<form id="form" method="post">
    <div class="form-wrapper">
	  <div class="h4 distance-double">
        <span class="h4-title"><i class="icon icon-setting"></i>商品SPU</span>
        <span class="h4-border"></span>
      </div>
      
      <input type="hidden" id="id" name="id"/> 
      
        <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>商品名称</p>
	        <input type="text" id="name" name="name" class="summer-input summer-validatebox"  data-validatebox="validType:['required','maxLength[300]']"/> 
	     </div>
	     
	      <div class="form-cont">
	        <p class="form-cont-title"><!-- <span class="field-required">*</span> -->商品品牌</p>
	        <input type="text" id="brand" name="brand" class="summer-input summer-validatebox"  data-validatebox="validType:['maxLength[300]']"/> 
	     </div>
	     
	      <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>是否精品</p>
	        <input type="text" id="isJingping" name="isJingping" class="summer-input summer-validatebox"  data-validatebox="validType:['required','maxLength[50]']"/> 
	     </div>
	     
	      <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>是否包邮</p>
	        <input type="text" id="isFreePost" name="isFreePost" class="summer-input summer-validatebox"  data-validatebox="validType:['required','maxLength[50]']"/> 
	     </div>
	     
	      <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>是否七天退换货</p>
	        <input type="text" id="isServenBack" name="isServenBack" class="summer-input summer-validatebox"  data-validatebox="validType:['required','maxLength[50]']"/> 
	     </div>
	     
	      <div class="form-cont">
	        <p class="form-cont-title">商品来源</p>
	        <input type="text" id="laiyuan" name="laiyuan" class="summer-input summer-validatebox"  data-validatebox="validType:['maxLength[500]']"/> 
	     </div>
	   
         
          <div class="form-cont">
	        <p class="form-cont-title">上市时间</p>
	        <input type="text" id="marketUpTime" name="marketUpTime" class="summer-input summer-validatebox"  onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" data-validatebox="validType:['maxLength[50]']"/> 
	     </div>
	     
	     <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>商品主图</p>
	        <input type="hidden" id="mainImageUrl" name="mainImageUrl" class="summer-input summer-validatebox"  data-validatebox="validType:['required']"/> 
		    <!--  <input type="text" id="mainImageUrl" name="mainImageUrl" class="summer-input summer-validatebox"  data-validatebox="validType:['maxLength[300]']"/> -->
		    <!-- 文件上传 -->
	     	<div >
				<div id="mainImageUrlFileList" class="uploader-list"></div>
				<div id="mainImageUrlFilePicker">选择图片</div>
				<p style="color:red">建议高：159px；宽：159px</p>
			</div>
	     </div>
	     
	      <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>商品的轮播图</p>
	        <input type="hidden" id="bannerImageUrls" name="bannerImageUrls" class="summer-input summer-validatebox"  data-validatebox="validType:['required']"/> 
	     	<!-- 文件上传 -->
	     	<div >
				<div id="fileList" class="uploader-list"></div>
				<div id="filePicker">选择图片</div>
				<p style="color:red">建议高：188px；宽：375px</p>
			</div>
	     </div>
	     
	     
	      <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>商品详情图</p>
	        <input type="hidden" id="detailImageUrls" name="detailImageUrls" class="summer-input summer-validatebox"  data-validatebox="validType:['required']"/>
	       <!--  <input type="text" id="detailImageUrls" name="detailImageUrls" class="summer-input summer-validatebox"  data-validatebox="validType:['required','maxLength[1000]']"/> --> 
	       <!-- 文件上传 -->
	     	<div >
				<div id="detailImageUrlsFileList" class="uploader-list"></div>
				<div id="detailImageUrlsFilePicker">选择图片</div>
				<p style="color:red">建议高：无限制；宽：375px</p>
			</div>
	     </div>
	     
	     <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>供货价格</p>
	        <input type="text" id="productGonghuoPrice" name="productGonghuoPrice" class="summer-input summer-validatebox"  data-validatebox="validType:['required','maxLength[50]']"/> 
	     </div>
	     
	     <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>优惠红包</p>
	        <input type="text" id="productHongbao" name="productHongbao" class="summer-input summer-validatebox"  data-validatebox="validType:['required','maxLength[50]']"/> 
	     </div>
	     
	     <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>红包开始时间</p>
	        <input type="text" id="startTime" name="startTime" class=" summer-input summer-validatebox"  data-validatebox="validType:['required']"  onFocus="var afterTime=$dp.$('stopTime');WdatePicker({dateFmt:'yyyy-MM-dd',onpicked:function(){afterTime.focus();},minDate:'#F{(\'%y-%M-%d\')}',maxDate:'#F{$dp.$D(\'stopTime\')}'})" /> 
	     </div>
	     
	    <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>红包结束时间</p>
	        <input type="text" id="stopTime" name="stopTime" class="summer-input" data-validatebox="validType:['required']" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'startTime\')}'})"/> 
	     </div>
	     
	     
	      <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>佣金比例(例：10)</p>
	        <input type="text" id="marketProfitPercent" name="marketProfitPercent" class="summer-input summer-validatebox"  data-validatebox="validType:['required','noNegativeNumber']"/> 
	     </div>
	     
	     <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>总销量</p>
	        <input type="text" id="totalSales" name="totalSales" class="summer-input summer-validatebox"  data-validatebox="validType:['required','noNegativeNumber']"/> 
	     </div>
	     
	      <div class="form-cont">
	        <p class="form-cont-title">推荐理由</p>
	        <textarea class="summer-textarea" id="note" name="note"></textarea>
	     </div>
	     
	     <div class="form-btn-wrapper" id="funcbar"> </div>
        </div> 
</form>	  
<form id="skufrom" method="post">

         <input type="hidden" id="id" name="id"/> 
	     <div class="h4 distance-double">
	        <span class="h4-title"><i class="icon icon-setting"></i>商品SKU</span>
	        <span class="h4-border"></span>
	    </div>
	    <div style="position: relative;height:30px;" id="addtitle"></div>
	    <div class="newtitleback">
	    	 <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>是否为主商品</p>
	        <input type="text" class="summer-input"  value="是"  id="isMainView" readonly="readonly"/>
	        <input type="hidden" id="isMain" name="isMain" value="1" class="summer-input summer-validatebox" readonly="readonly"  data-validatebox="validType:['required','maxLength[50]']"/> 
	     </div>
	     
	     <!-- <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>商品的轮播图</p>
	        <input type="text" id="bannerUrls" name="bannerUrls" class="summer-input summer-validatebox"  data-validatebox="validType:['maxLength[1000]']"/> 
	     </div> -->
	     
	     <input type="hidden" id="productPropertys" name="productPropertys"/>
	    
	    <%--  <div class="form-cont" id="afterProperty0">
	        <p class="form-cont-title"><!-- <span class="field-required">*</span> -->商品属性</p>
	        <input type="text" id="productProperty0" name="productProperty0" class="summer-input" data-validatebox="validType:['required','maxLength[50]']" />
	        
            <input type="text" id="productPropertyValue0" name="productPropertyValue0" class="summer-input"/>
            <a onclick="addProperty()"><img alt="" src="<%=request.getContextPath()%>/static/images/edit_add.png"></a>
	     </div> --%>
	     <div class="addproduct"></div>
	    
	     <div>
	        
	     </div>
	     <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>库存</p>
	        <input type="text" id="productInventory" name="productInventory" class="summer-input summer-validatebox"  data-validatebox="validType:['required','maxLength[50]']"/> 
	     </div>
	     
	     <div class="form-cont">
	        <p class="form-cont-title"><!-- <span class="field-required">*</span> -->商品价格</p>
	        <input type="text" id="productOrginPrice" name="productOrginPrice" class="summer-input summer-validatebox"  data-validatebox="validType:['maxLength[50]']"/> 
	     </div>
	     
	     
	      <div class="form-cont">
	        <p class="form-cont-title">备注</p>
	        <textarea class="summer-textarea" id="note" name="note"></textarea>
	     </div>
	      
     
         
	    </div>
		<div class="form-btn-wrapper" id="funcbarSku">
               <a class="btn btn-normal" id="backBtn">关闭</a>
          </div>
</form>

<script>
    
  var   editData,
        permission = CommonUtil.getPermission('${name_english}');
  var count = 0;
    $(function () {
    	
    	 
    	
    	//初始化funcbar
     	$('#funcbar').prepend($.funcbar({
            type: 'button',
            data: permission,
            permit: ['${name_english}:edit']
        }));
    	
    	//初始化funcbar
     	$('#funcbarSku').prepend($.funcbar({
            type: 'button',
            data: permission,
            permit: ['${name_english}:editSku']
        }));
    	
    	editData = ${editData};
    	skus = ${mainSku};
    	
    	console.log(skus);
    	//库存
    	var kucun = skus.mainSku.productInventory;
    	$("#productInventory").val(kucun);
    	//商品价格
    	var skuprice = skus.mainSku.productOrginPrice
    	$("#productOrginPrice").val(skuprice);
    	
    	var skus_json = skus.mainSku.productPropertys.split(",");
    	
    	//读取商品属性数据
    	
    	for(var i=0;i<skus_json.length;i++){
    		count++;
    		var skus_id = skus_json[i].split(":");
    		var html = '<div class="form-cont" id="afterProperty'+i+'">'+
					        '<p class="form-cont-title">商品属性</p>'+
					        '<input type="text" id="productProperty'+i+'" name="productProperty'+i+'" class="summer-input"/>'+
					        '<input type="text" id="productPropertyValue'+i+'" name="productPropertyValue'+i+'" class="summer-input"/>'+ 
					        '<a onclick="removeProperty('+i+')"><img alt="" src="<%=request.getContextPath()%>/static/images/edit_remove.png"></a>'+
				     	'</div>'
		    
			 $(".addproduct").append(html);
		     $('#productProperty'+i).combobox({
		    	valueField : 'id',
            	textField : 'name',
            	defaultValue : skus_id[0],
            	url : CONST_URL.PRODUCT_PROPERTYS
            	
		     })  
				     	
    		 $('#productPropertyValue'+i).combobox({
 			   async:false,
 		       valueField : 'id',
 		       defaultValue : skus_id[1],
 		       textField:'propertyValue',
 		       url : CONST_URL.PRODUCT_PROPERTY_VALUES+"?propertyId="+skus_id[0]
           }); 
		    modfiycon(i);
    	}
    	
    	$(".addproduct #afterProperty0").find("a").remove();
    	$(".addproduct #afterProperty0 .summer-combobox:eq(1)").after(
    			'<a onclick=addPropertySku("'+count+'")><img src="<%=request.getContextPath()%>/static/images/edit_add.png"></a>'
    			)
    	
    	//添加标题
    	 $("#addtitle").append(
    			'<div class="newtitle" id="hometitle" onclick = addtit("'+skus.id+'")>'+skus.title+'</div>'
    			)
    	var skus_tit = skus.skus;
    	//console.log(skus)
    	$.each(skus_tit,function(key,value){
    		//console.log(value.title);
    		$("#hometitle").after(
    				'<div class="newtitle" onclick = addtit("'+value.id+'")>'+value.title+'</div>'
    				)
    	})
    	/* $("#addtitle").append(
    			'<div>''</div>'
    			)
    	 */
    	
    	
    	
    	
    	
    	//console.log(CONST_URL.PRODUCT_PROPERTYS);
    	//首页位置
    	
 	   $('#indexLocation').combobox({
 		 async: false,
 		 defalutValue: editData.indexLocation,
         valueField : 'code',
         textField : 'name',
         url : COMMON_URL.getCode + '?type=T_MALL_INDEX_LOCATION'
     });
  	
   	//初始化下拉选项
 	   $('#isFreePost').combobox({
 		  async: false,
  		 defalutValue: editData.isFreePost,
         valueField : 'code',
         textField : 'name',
         url : COMMON_URL.getCode + '?type=T_DM_COMMON_YESORNOT'
     });
   	
 	//初始化下拉选项
   	   $('#isJingping').combobox({
           valueField : 'code',
           defaultValue:editData.isJingping,
           async:false,
           textField : 'name',
           url : COMMON_URL.getCode + '?type=T_DM_COMMON_YESORNOT'
       });
 	
   	  //初始化下拉选项
   	   $('#laiyuan').combobox({
           valueField : 'id',
           defaultValue:editData.laiyuan,
           async:false,
           textField : 'name',
           url : CONST_URL.COMPANYS
       });
   
 	   $('#isServenBack').combobox({
 		  async: false,
   		 defalutValue: editData.isServenBack,
         valueField : 'code',
         textField : 'name',
         url : COMMON_URL.getCode + '?type=T_DM_COMMON_YESORNOT'
     });
    	
    	
        $('#form').form().form('loadDataEdit', {
            data: editData
        }); 
        
        $("#skufrom #id").val(skus.id);
    	

        filePlugin("#bannerImageUrls","#filePicker","#fileList");
    	filePlugin("#mainImageUrl","#mainImageUrlFilePicker","#mainImageUrlFileList");
    	filePlugin("#detailImageUrls","#detailImageUrlsFilePicker","#detailImageUrlsFileList");
    	//保存按钮
    	$('#funcbar').on('click', 'a[data-permit="${name_english}:edit"]', submit);
    	
    	//保存按钮
    	$('#funcbarSku').on('click', 'a[data-permit="${name_english}:editSku"]', submitSku);
    	
    	//返回按钮
    	$('#backBtn, #goBack').on('click',backMain);
    });
 
/***********************************/
	function addtit(obj){
		 $.ajax({
		        url: CONST_URL.VIEW_SKU,
		        type: 'post',
		        dataType: 'json',
		        data: {
		            id: obj
		        },
		        success: function (data) {
		            //console.log(data);
		            sameevent(data);
		        }
		    });
	}
	//相同的点击切换内容
	function sameevent(data){
	
		$(".newtitleback").empty();
		
		var html = '<input type="hidden" id="productPropertys" name="productPropertys">'
						+'<div class="addproduct">'
						+'</div>'
						+'<div class="form-cont">'
							+'<p class="form-cont-title"><span class="field-required">*</span>库存</p>'
							+'<input type="text" id="productInventory" name="productInventory" class="summer-input">'
						+'</div>'
						+'<div class="form-cont">'
							+'<p class="form-cont-title">商品价格</p>'
							+'<input type="text" id="productOrginPrice" name="productOrginPrice" class="summer-input">'
						+'</div>'
						+'<div class="form-cont">'
							+'<p class="form-cont-title">备注</p>'
							+'<textarea type="text" id="note" name="note" class="summer-textarea"></textarea>'
						+'</div>';
		$(".newtitleback").append(html);
		
		 $('#productInventory').validatebox({
			       tipPosition: 'right',
			       validType:['required','positiveInteger']
			    });
		 
		 $('#productOrginPrice').validatebox({
		       tipPosition: 'right',
		       validType:['required','noNegativeNumber']
		    });

		//console.log(data);
		sameproductProperty(data);
		
	}
//属性的追加	
function sameproductProperty(data){
	//console.log(data);
	var sameproety = data.productPropertys.split(",");
	//console.log(sameproety) 
	for(var i=0;i<sameproety.length;i++){
		count++;
		//console.log(sameproety[i])
		var sameprojson = sameproety[i].split(":");
		var html = '<div class="form-cont" id="afterProperty'+i+'">'+
					        '<p class="form-cont-title">商品属性</p>'+
					        '<input type="text" id="productProperty'+i+'" name="productProperty'+i+'" class="summer-input"/>'+
					        '<input type="text" id="productPropertyValue'+i+'" name="productPropertyValue'+i+'" class="summer-input"/>'+ 
					        '<a onclick="removeProperty('+i+')"><img alt="" src="<%=request.getContextPath()%>/static/images/edit_remove.png"></a>'+
				     	'</div>'
		    
		$(".addproduct").append(html);
		 $('#productProperty'+i).combobox({
		    	valueField : 'id',
            	textField : 'name',
            	defaultValue : sameprojson[0],
            	url : CONST_URL.PRODUCT_PROPERTYS
            	
		     })  
				     	
    		 $('#productPropertyValue'+i).combobox({
 			   async:false,
 		       valueField : 'id',
 		       defaultValue : sameprojson[1],
 		       textField:'propertyValue',
 		       url : CONST_URL.PRODUCT_PROPERTY_VALUES+"?propertyId="+sameprojson[0]
           }); 
		 modfiycon(i);
	}
	$(".addproduct #afterProperty0").find("a").remove();
    $(".addproduct #afterProperty0 .summer-combobox:eq(1)").after(
    			'<a onclick=addPropertySku("'+count+'")><img src="<%=request.getContextPath()%>/static/images/edit_add.png"></a>'
    		)
	$("#productInventory").val(data.productInventory);
	$("#productOrginPrice").val(data.productOrginPrice);
	$("#skufrom #id").val(data.id);	
	//console.log(data);
}






  //删除商品属性
  
	function removeProperty(obj){
		
		$("#afterProperty"+obj).remove();
		count--;
		
	}
	//修改内容
	function modfiycon(obj){
		
		//console.log(obj)
		$("#productProperty"+obj).combobox({
			valueField : 'id',
        	textField : 'name',
        	url : CONST_URL.PRODUCT_PROPERTYS,
        	
        	onSelect:function(objs){
        		//console.log(objs,CONST_URL.PRODUCT_PROPERTY_VALUES+"?propertyId="+objs.id)
        		$('#productPropertyValue'+obj).combobox({
            		async:false,
                    valueField : 'id',
                    textField : 'propertyValue',
                    url : CONST_URL.PRODUCT_PROPERTY_VALUES+"?propertyId="+objs.id
                });
        		$('#productPropertyValue'+obj).combobox('reload', CONST_URL.PRODUCT_PROPERTY_VALUES+"?propertyId="+objs.id);
        	}
        	
		})
	}
    //增加商品
      var i=0;
    function addPropertySku(){
    	
   	 var j = i;
    	 j++;
    /* var j=i;
    	i++; */
    	 $(".addproduct").append('<div class="form-cont" id="afterProperty'+count+'">'+
					    	        '<p class="form-cont-title">商品属性</p>'+
					    	        '<input type="text" id="productProperty'+count+'" name="productProperty'+count+'" class="summer-input"/>'+
					    	        '<input type="text" id="productPropertyValue'+count+'" name="productPropertyValue'+count+'" class="summer-input"/>'+ 
					    	        '<a onclick="removeProperty('+count+')"><img alt="" src="<%=request.getContextPath()%>/static/images/edit_remove.png"></a>'+
					    	     '</div>');
    	
    	   //初始化下拉选项
    	   newcount(count);
    	   
    	   count++;
    }
    //增加的下拉框
    function newcount(count){
    	 $('#productProperty'+count).combobox({
             valueField : 'id',
         	textField : 'name',
         	url : CONST_URL.PRODUCT_PROPERTYS,
         	onSelect: function(record){
         		//console.log(count,record,CONST_URL.PRODUCT_PROPERTY_VALUES+"?propertyId="+record.id);
         		//初始化下拉选项
             	 $('#productPropertyValue'+count).combobox({
             		   async:false,
             		   valueField : 'id',
                        textField : 'propertyValue',
                        url : CONST_URL.PRODUCT_PROPERTY_VALUES+"?propertyId="+record.id
                 });
          	   
             	$('#productPropertyValue'+count).combobox('reload', CONST_URL.PRODUCT_PROPERTY_VALUES+"?propertyId="+record.id);
             }
      });
    }
 
    //表单提交
    function submit() {
		
		
         $("#form").form({
        	 buttons : ['#saveBtn'],
             ajax: {
                 url: CONST_URL.EDIT
             },
             onSubmitSuccess: function (data) {
            	 $.stip({
   	                type:'ok',//显示类型 有info、 ok、 danger
   	                text: '保存成功！',
   	                onBeforeHide: function () {
   	                	//backMain();
   	                }
            	 });
              }
         }).form("submit");
    }
    
    //表单提交
    function submitSku(event) {
    	 var pro0 = $('#productProperty'+count).combobox("getValue");
		  //console.log(count);
	   	 if( pro0 ){
	   		 var proVal0 = $('#productPropertyValue'+count).combobox("getValue");
	   		 if( proVal0 ){
	   			  var value = "";
            		 for(var t=0;t<count;t++){
            			 value += $('#productProperty'+t).combobox("getValue");
               			 value += ":";
               	    	 value += $('#productPropertyValue'+t).combobox("getValue");
               	    	 value += ","
            		 }
            	value=value.substring(0,value.length-1);
				// console.log(value);
	       		 $("#productPropertys").val(value);
	   		 }
	   	 }
         $("#skufrom").form({
        	 buttons : ['#saveBtn'],
             ajax: {
                 url: CONST_URL.EDIT_SKU
             },
             onSubmitSuccess: function (data) {
            	 $.stip({
   	                type:'ok',//显示类型 有info、 ok、 danger
   	                text: '保存成功！',
   	                onBeforeHide: function () {
   	                	//backMain();
						
   	                }
            	 });
              }
         }).form("submit");
    }
    
    
    //返回主页面
    function backMain() {
    	window.location.href = CONST_URL.INIT_LIST;
    	//window.location.href = CONST_URL.INIT_MAIN;
    	//parent.refreshList(editData.id);
    }
    
    //请求url
    var CONST_URL = {
   		INIT_LIST: basePath + "${common_url}initList?categoryId=${categoryId}",
    	INIT_MAIN: basePath + "${common_url}init",
       	EDIT: basePath + "${common_url}edit",
       	VIEW_SKU:basePath + "${common_url}viewSku",
       	EDIT_SKU: basePath + "${common_url}editSku",
       	PRODUCT_PROPERTY_VALUES: basePath + "${common_url}getProductPropertyValues",
       	COMPANYS: basePath + "${common_url}companys",
       	PRODUCT_PROPERTYS: basePath + "${common_url}getProductPropertys"
    };
    
</script>
</body>
</html>